package com.yy.hi.app.demo.tab

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.yy.hi.app.R
import com.yy.hi.library.hilog.HiLog
import com.yy.hi.ui.tab.bottom.HiTabBottomInfo
import com.yy.hi.ui.tab.common.IHiTabLayout
import kotlinx.android.synthetic.main.activity_hi_tab_bottom_demo.*

class HiTabBottomDemoActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_hi_tab_bottom_demo)
        initBottomLayout()
    }

    private fun initBottomLayout() {
        bottom.setBottomAlpha(0.8f)
        val bottomList = ArrayList<HiTabBottomInfo<*>>()
        val mHiTabBottomInfo = HiTabBottomInfo("首页", "fonts/iconfont.ttf",
                getString(R.string.if_home), null, "#ff656667", "#ffd44949")
        val collect = HiTabBottomInfo("分类", "fonts/iconfont.ttf",
                getString(R.string.if_category), null, "#ff656667", "#ffd44949")
        val divide = HiTabBottomInfo("推荐", "fonts/iconfont.ttf",
                getString(R.string.if_recommend), null, "#ff656667", "#ffd44949")
        val person = HiTabBottomInfo("我的", "fonts/iconfont.ttf",
                getString(R.string.if_profile), null, "#ff656667", "#ffd44949")
        bottomList.add(mHiTabBottomInfo)
        bottomList.add(collect)
        bottomList.add(divide)
        bottomList.add(person)
        bottom.inflateInfo(bottomList)
        bottom.defaultSelected(mHiTabBottomInfo)
        bottom.addTabSelectedChangeListener(object : IHiTabLayout
        .OnTabSelectedListener<HiTabBottomInfo<*>> {
            override fun onTabSelectedChange(
                    index: Int, preInfo: HiTabBottomInfo<*>, nextInfo: HiTabBottomInfo<*>
            ) {
                HiLog.e("bottom")
            }
        })
        bottom.setBottomLineHeight(10.0f)
    }
}